#标准库，用于创建图形用户界面（GUI），支持窗口、按钮、文本框等控件的创建和管理。
import tkinter as tk
from tkinter import PhotoImage
#第三方库，用于图像处理，支持图像打开、编辑、保存、格式转换等操作。Pillow 是 PIL 的现代分支，功能更强大且兼容性更好。
from PIL import Image, ImageTk, ImageFont
#标准库，提供与操作系统交互的功能，如文件路径操作、环境变量管理、目录创建与删除等。
import os
import json

class shareddata:
    #根目录绝对路径
    ROOT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
    ROOT_DIRECTORY = ROOT_DIRECTORY.replace(r"\CodePython", "")
    # 将 \ 替换为 / 
    ROOT_DIRECTORY = ROOT_DIRECTORY.replace("\\", "/")
    #字体路径
    font_path = ROOT_DIRECTORY + "/TextFont/ALGER.woff.ttf"  
    #用户数据
    player_path = ROOT_DIRECTORY + "/Data/Player/*.json"
    #玩家
    player = dict()   
    #图像
    picture = dict()
    #关卡
    chapter = []

    equipmentlist = [
        [
            {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
            {'No.': '0.01.100.001100', "type": "enchant", 'Zatk': 1.0, 'Zele': 1.0, "worth": 200000},
            {'No.': '0.02.100.002100', "type": "clothes", 'Bhp': 100, 'Bele': 1.0, "worth": 200000},
            {'No.': '0.03.100.003100', "type": "core", 'Zhp': 1.0, 'Zele': 1.0, "worth": 200000},
            {'No.': '0.04.100.004100', "type": "shoes", 'Bdef': 100, 'Bele': 1.0, "worth": 200000},
            {'No.': '0.05.100.005100', "type": "medal", 'Zdef': 1.0, 'Zele': 1.0, "worth": 200000}
        ],
        [
            {"No.": "1.00.80.10080","type": "weapon","Batk": 80,"Bele": 0.8, "worth": 20000},
            {"No.": "1.01.80.10180","type": "enchant","Zatk": 0.8,"Zele": 0.8, "worth": 20000},
            {"No.": "1.02.80.10280","type": "clothes","Bhp": 80,"Bele": 0.8, "worth": 20000},
            {"No.": "1.03.80.10380","type": "core","Zhp": 0.8,"Zele": 0.8, "worth": 20000},
            {"No.": "1.04.80.10480","type": "shoes","Bdef": 80,"Bele": 0.8, "worth": 20000},
            {"No.": "1.05.80.10580","type": "medal","Zdef": 0.8,"Zele": 0.8, "worth": 20000}
        ],
        [
            {"No.": "2.00.60.20060","type": "weapon","Batk": 60,"Bele": 0.6, "worth": 2000},
            {"No.": "2.01.60.20160","type": "enchant","Zatk": 0.6,"Zele": 0.6, "worth": 2000},
            {"No.": "2.02.60.20260","type": "clothes","Bhp": 60,"Bele": 0.6, "worth": 2000},
            {"No.": "2.03.60.20360","type": "core","Zhp": 0.6,"Zele": 0.6, "worth": 2000},
            {"No.": "2.04.60.20460","type": "shoes","Bdef": 60,"Bele": 0.6, "worth": 2000},
            {"No.": "2.05.60.20560","type": "medal","Zdef": 0.6,"Zele": 0.6, "worth": 2000}
        ],
        [
            {"No.": "3.00.40.30040","type": "weapon","Batk": 40,"Bele": 0.4, "worth": 200},
            {"No.": "3.01.40.30140","type": "enchant","Zatk": 0.4,"Zele": 0.4, "worth": 200},
            {"No.": "3.02.40.30240","type": "clothes","Bhp": 40,"Bele": 0.4, "worth": 200},
            {"No.": "3.03.40.30340","type": "core","Zhp": 0.4,"Zele": 0.4, "worth": 200},
            {"No.": "3.04.40.30440","type": "shoes","Bdef": 40,"Bele": 0.4, "worth": 200},
            {"No.": "3.05.40.30540","type": "medal","Zdef": 0.4,"Zele": 0.4, "worth": 200}

        ],
        [
            {"No.": "4.00.20.40020","type": "weapon","Batk": 20,"Bele": 0.2, "worth": 20},
            {"No.": "4.01.20.40120","type": "enchant","Zatk": 0.2,"Zele": 0.2, "worth": 20},
            {"No.": "4.02.20.40220","type": "clothes","Bhp": 20,"Bele": 0.2, "worth": 20},
            {"No.": "4.03.20.40320","type": "core","Zhp": 0.2,"Zele": 0.2, "worth": 20},
            {"No.": "4.04.20.40420","type": "shoes","Bdef": 20,"Bele": 0.2, "worth": 20},
            {"No.": "4.05.20.40520","type": "medal","Zdef": 0.2,"Zele": 0.2, "worth": 20}
        ]
    ]
    '''
    #装备信息
    equipmentlist = {}
    for i in range(5):
        with open(ROOT_DIRECTORY + "/EquipmentData/" + str(i) + ".txt", 'r', encoding='utf-8') as f:
            equipment = json.load(f)
            for key, value in equipment.items():
                equipmentlist[str(i) + "." + key] = {}
                for a, b in value.items():
                    equipmentlist[str(i) + "." + key][a] = b
    
    print(equipmentlist)
    '''

    def player_initialization():
        shareddata.player = {
            "neckname": "",
            "level": 999,
            "exp": 99999,
            "crystal": 599999,
            "coin": 5999999,
            "fight": "0-0",
            "characterlist": {
                "0": {
                    "name": "KianaZY",
                    "unlock": 1,
                    "level": 0,
                    "Bhp": 200, "Zhp": 0.0,
                    "Batk": 200, "Zatk": 0.0,
                    "Bdef": 200,  "Zdef": 0.0,
                    "Bele": 2.0, "Zele": 0.0,
                    "equip":{
                        "weapon": { "No.": "0.00.100.YZH", "type": "weapon", "Batk": 100, "Bele": 1.0, "worth": 200000},
                        "enchant": { "No.": "0.01.100.001100", "type": "enchant", "Zatk": 1.0, "Zele": 1.0, "worth": 200000},
                        "clothes": { "No.": "0.02.100.002100", "type": "clothes", "Bhp": 100, "Bele": 1.0, "worth": 200000},
                        "core":{ "No.": "0.03.100.003100", "type": "core", "Zhp": 1.0, "Zele": 1.0, "worth": 200000},
                        "shoes":{ "No.": "0.04.100.004100", "type": "shoes", "Bdef": 100, "Bele": 1.0, "worth": 200000},
                        "medal":{ "No.": "0.05.100.005100", "type": "medal", "Zdef": 1.0, "Zele": 1.0, "worth": 200000}
                    }
                },
                "1": {
                    "name": "KianaXY",
                    "unlock": 1,
                    "level": 0,
                    "Bhp": 200, "Zhp": 0.0,
                    "Batk": 200, "Zatk": 0.0,
                    "Bdef": 200,  "Zdef": 0.0,
                    "Bele": 2.0, "Zele": 0.0,
                    "equip":{
                        "weapon": { "No.": "0.00.100.YZH", "type": "weapon", "Batk": 100, "Bele": 1.0, "worth": 200000},
                        "enchant": { "No.": "0.01.100.001100", "type": "enchant", "Zatk": 1.0, "Zele": 1.0, "worth": 200000},
                        "clothes": { "No.": "0.02.100.002100", "type": "clothes", "Bhp": 100, "Bele": 1.0, "worth": 200000},
                        "core":{ "No.": "0.03.100.003100", "type": "core", "Zhp": 1.0, "Zele": 1.0, "worth": 200000},
                        "shoes":{ "No.": "0.04.100.004100", "type": "shoes", "Bdef": 100, "Bele": 1.0, "worth": 200000},
                        "medal":{ "No.": "0.05.100.005100", "type": "medal", "Zdef": 1.0, "Zele": 1.0, "worth": 200000}
                    }
                },
                "2": {
                    "name": "ElysiaSY",
                    "unlock": 1,
                    "level": 0,
                    "Bhp": 200, "Zhp": 0.0,
                    "Batk": 100, "Zatk": 0.0,
                    "Bdef": 100,  "Zdef": 0.0,
                    "Bele": 1.0, "Zele": 0.0,
                    "equip":{
                        "weapon": { "No.": "0.00.100.YZH", "type": "weapon", "Batk": 100, "Bele": 1.0, "worth": 200000},
                        "enchant": { "No.": "0.01.100.001100", "type": "enchant", "Zatk": 1.0, "Zele": 1.0, "worth": 200000},                            
                        "clothes": { "No.": "0.02.100.002100", "type": "clothes", "Bhp": 100, "Bele": 1.0, "worth": 200000},
                        "core":{ "No.": "0.03.100.003100", "type": "core", "Zhp": 1.0, "Zele": 1.0, "worth": 200000},
                        "shoes":{ "No.": "0.04.100.004100", "type": "shoes", "Bdef": 100, "Bele": 1.0, "worth": 200000},
                        "medal":{ "No.": "0.05.100.005100", "type": "medal", "Zdef": 1.0, "Zele": 1.0, "worth": 200000}
                    }
                },
                "3": {
                    "name": "Mei",
                    "unlock": 1,
                    "level": 0,
                    "Bhp": 100, "Zhp": 0.0,
                    "Batk": 200, "Zatk": 0.0,
                    "Bdef": 100,  "Zdef": 0.0,
                    "Bele": 1.0, "Zele": 0.0,
                    "equip":{
                        "weapon": { "No.": "0.00.100.YZH", "type": "weapon", "Batk": 100, "Bele": 1.0, "worth": 200000},
                        "enchant": { "No.": "0.01.100.001100", "type": "enchant", "Zatk": 1.0, "Zele": 1.0, "worth": 200000},
                        "clothes": { "No.": "0.02.100.002100", "type": "clothes", "Bhp": 100, "Bele": 1.0, "worth": 200000},
                        "core":{ "No.": "0.03.100.003100", "type": "core", "Zhp": 1.0, "Zele": 1.0, "worth": 200000},
                        "shoes":{ "No.": "0.04.100.004100", "type": "shoes", "Bdef": 100, "Bele": 1.0, "worth": 200000},
                        "medal":{ "No.": "0.05.100.005100", "type": "medal", "Zdef": 1.0, "Zele": 1.0, "worth": 200000}
                    }
                },
                "4": {
                    "name": "Firefly",
                    "unlock": 1,
                    "level": 0,
                    "Bhp": 100, "Zhp": 0.0,
                    "Batk": 100, "Zatk": 0.0,
                    "Bdef": 200,  "Zdef": 0.0,
                    "Bele": 1.0, "Zele": 0.0,
                    "equip":{
                        "weapon": { "No.": "0.00.100.YZH", "type": "weapon", "Batk": 100, "Bele": 1.0, "worth": 200000},
                        "enchant": { "No.": "0.01.100.001100", "type": "enchant", "Zatk": 1.0, "Zele": 1.0, "worth": 200000},
                        "clothes": { "No.": "0.02.100.002100", "type": "clothes", "Bhp": 100, "Bele": 1.0, "worth": 200000},
                        "core":{ "No.": "0.03.100.003100", "type": "core", "Zhp": 1.0, "Zele": 1.0, "worth": 200000},
                        "shoes":{ "No.": "0.04.100.004100", "type": "shoes", "Bdef": 100, "Bele": 1.0, "worth": 200000},
                        "medal":{ "No.": "0.05.100.005100", "type": "medal", "Zdef": 1.0, "Zele": 1.0, "worth": 200000}
                    }
                },
                "5": {
                    "name": "Sirin",
                    "unlock": 1,
                    "level": 0,
                    "Bhp": 100, "Zhp": 0.0,
                    "Batk": 200, "Zatk": 0.0,
                    "Bdef": 100,  "Zdef": 0.0,
                    "Bele": 1.0, "Zele": 0.0,
                    "equip":{
                        "weapon": { "No.": "0.00.100.YZH", "type": "weapon", "Batk": 100, "Bele": 1.0, "worth": 200000},
                        "enchant": { "No.": "0.01.100.001100", "type": "enchant", "Zatk": 1.0, "Zele": 1.0, "worth": 200000},
                        "clothes": { "No.": "0.02.100.002100", "type": "clothes", "Bhp": 100, "Bele": 1.0, "worth": 200000},
                        "core":{ "No.": "0.03.100.003100", "type": "core", "Zhp": 1.0, "Zele": 1.0, "worth": 200000},
                        "shoes":{ "No.": "0.04.100.004100", "type": "shoes", "Bdef": 100, "Bele": 1.0, "worth": 200000},
                        "medal":{ "No.": "0.05.100.005100", "type": "medal", "Zdef": 1.0, "Zele": 1.0, "worth": 200000}
                    }
                }
            },
            "bag": [
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '0.00.100.YZH', "type": "weapon", 'Batk': 100, 'Bele': 1.0, "worth": 200000},
                {'No.': '1.04.80.30480', 'type': 'shoes', 'Bdef': 80, 'Bele': 0.8, "worth": 20000},
                {'No.': '2.04.60.30460', 'type': 'shoes', 'Bdef': 60, 'Bele': 0.6, "worth": 2000},
                {'No.': '3.04.40.30440', 'type': 'shoes', 'Bdef': 40, 'Bele': 0.4, "worth": 200},
                {'No.': '4.04.20.30420', 'type': 'shoes', 'Bdef': 20, 'Bele': 0.2, "worth": 20}
            ]
        }

    def picture_initialization():
        shareddata.picture = {
            "EquipmentList": {
                "Frame": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/Frame/{i}.png").resize((70, 70)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/Frame/{i}.png").resize((70, 70)).convert("RGBA"))) for i in range(5)],
                "0": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/0/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/0/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"))) for i in range(6)],
                "1": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/1/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/1/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"))) for i in range(6)],
                "2": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/2/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/2/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"))) for i in range(6)],
                "3": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/3/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/3/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"))) for i in range(6)],
                "4": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/4/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/EquipmentList/4/{str(i).zfill(2)}.png").resize((50, 50)).convert("RGBA"))) for i in range(6)]
            },
            "CharacterList":{
                "Icon": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/CharacterList/Icon/{i}.png").resize((80, 80)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/CharacterList/Icon/{i}.png").resize((80, 80)).convert("RGBA"))) for i in range(6)],
                "IconFrame": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/CharacterList/IconFrame.png").resize((120, 568)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + "/Picture/CharacterList/IconFrame.png").resize((120, 568)).convert("RGBA"))]
            },
            #√
            "Resources": {
                "ButtonList": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/Resources/PageButton/{i}.png").resize((80, 80)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/Resources/PageButton/{i}.png").resize((80, 80)).convert("RGBA"))) for i in range(5)],
                "EqRmButton": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/EqRmButton.png").resize((70, 30)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/EqRmButton.png").resize((70, 30))).convert("RGBA"))],
                #head
                "HeadFrame": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/HeadFrame.png").resize((450, 100)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/HeadFrame.png").resize((450, 100))).convert("RGBA"))],
                "KianaHead": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/KianaHead.png").resize((80, 80)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/KianaHead.png").resize((80, 80))).convert("RGBA"))],
                "Crystal": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/Crystal.png").resize((30, 30)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/Crystal.png").resize((30, 30))).convert("RGBA"))],
                "Coin": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/Coin.png").resize((30, 30)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/Resources/Coin.png").resize((30, 30))).convert("RGBA"))],
            },
            #√
            "PageZero": {
                "Logo": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZero/Logo.png").resize((600, 600)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZero/Logo.png").resize((600, 600))).convert("RGBA"))]
            }, 
            #√
            "PageStart": {
                "BackGround": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageStart/BackGround.png").resize((1200, 720)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageStart/BackGround.png").resize((1200, 720))).convert("RGBA"))],
                "Title": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageStart/Title.png").resize((1176, 100)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageStart/Title.png").resize((1176, 100))).convert("RGBA"))],
                "GoButtonOut": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageStart/GoButtonOut.png").resize((300, 100)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageStart/GoButtonOut.png").resize((300, 100))).convert("RGBA"))],
                "GoButtonIn": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageStart/GoButtonIn.png").resize((300, 100)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageStart/GoButtonIn.png").resize((300, 100))).convert("RGBA"))],
                "Animation": [(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/PageStart/KianaNXSAnimation/{i}.png").resize((600, 300)).convert("RGBA"),ImageTk.PhotoImage(Image.open(shareddata.ROOT_DIRECTORY + f"/Picture/PageStart/KianaNXSAnimation/{i}.png").resize((600, 300)).convert("RGBA"))) for i in range(31)]
            }, 
            "PageHome": {
                "BackGround": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageHome/BackGround.png").resize((1200, 720)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageHome/BackGround.png").resize((1200, 720))).convert("RGBA"))]
            }, 
            "PageRole": {
                "BackGround": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageRole/BackGround.png").resize((1200, 720)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageRole/BackGround.png").resize((1200, 720))).convert("RGBA"))]
            }, 
            "PageForge": {
                "BackGround": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageForge/BackGround.png").resize((1200, 720)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageForge/BackGround.png").resize((1200, 720))).convert("RGBA"))],
            }, 
            "PageFight": {
                "BackGround": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageFight/BackGround.png").resize((1200, 720)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageFight/BackGround.png").resize((1200, 720))).convert("RGBA"))],    
            }, 
            "PageSet": {
                "BackGround": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageSet/BackGround.png").resize((1200, 720)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageSet/BackGround.png").resize((1200, 720))).convert("RGBA"))],
            }, 
            "PageZhandoushuang": {
                "Tip": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Tip.png").resize((1200, 720)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Tip.png").resize((1200, 720))).convert("RGBA"))],
                "PanelFrame": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/PanelFrame.png").resize((500, 100)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/PanelFrame.png").resize((500, 100))).convert("RGBA"))],
                "TopFrame": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/TopFrame.png").resize((180, 200)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/TopFrame.png").resize((180, 200))).convert("RGBA"))],
                "Zd": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Zd.png").resize((50, 25)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Zd.png").resize((50, 25))).convert("RGBA"))],
                "Dz": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Dz.png").resize((1500, 600)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Dz.png").resize((1500, 600))).convert("RGBA"))],
                "Kiana": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/KianaHead.png").resize((80, 80)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/KianaHead.png").resize((80, 80))).convert("RGBA"))],
                "Hutao": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Hutao.png").resize((80, 80)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Hutao.png").resize((80, 80))).convert("RGBA"))],
                "Victory": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Victory.png").resize((500, 280)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Victory.png").resize((500, 280))).convert("RGBA"))],
                "Enemy": [Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Enemy.png").resize((50, 50)).convert("RGBA"), ImageTk.PhotoImage((Image.open(shareddata.ROOT_DIRECTORY + "/Picture/PageZhandoushuang/Enemy.png").resize((50, 50))).convert("RGBA"))],
                }
        }
    
    def chapter_initialization():
        for i in range(1,11):
            for j in range (1,6):
                with open(shareddata.ROOT_DIRECTORY + "/Data/Fight/" + str(i) + "-" + str(j) + ".json", 'r', encoding = 'utf-8') as f:
                    data = json.load(f)
                    shareddata.chapter.append(data)

    def get_ROOT_DIRECTORY():
        return shareddata.ROOT_DIRECTORY
    def get_font_path():
        return shareddata.font_path
    def get_font(value):
        return ImageFont.truetype(shareddata.get_font_path(), value)
    def get_player_path():
        return shareddata.player_path
    def get_player():
        return shareddata.player
    def get_neckname():
        return shareddata.player["neckname"]
    def get_picture(page):
        return shareddata.picture[page]
    def get_chapter():
        return shareddata.chapter


    def set_player_path(value):
        shareddata.player_path = value
    def set_player(value):
        shareddata.player = value
        with open(shareddata.get_player_path(), 'w', encoding = 'utf-8') as f:
            json.dump(value, f, indent = 4)
    def set_neckname(value):
        shareddata.player["neckname"] = value